namespace Collaboris.Saf.Actions.Wss.Tests.Generated
{
    using Engine.Report;

    using Microsoft.SharePoint;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Saf.Tests;
    using Entities;

    using SharePoint.Wss.Lists;

    using Wss.List;

    /// <summary>
    /// This test was originally generated but has now been tested and verfiied by MJ
    /// </summary>
    [TestClass]
    public class AddListItemEventReceiverTest
    {

        [TestMethod]
        public void AddListItemEventReceiver_Test()
        {
            WSSTestAssistant<AddListItemEventReceiver, ListItemEventInfo> addlistitemeventreceiver =
                    new WSSTestAssistant<AddListItemEventReceiver, ListItemEventInfo>(TestEnvironment.PublishingSite, "AddListItemEventReceiverTestWeb", "BLANKINTERNET#0");

            using (addlistitemeventreceiver)
            {
                MacroReport doReport = addlistitemeventreceiver.DoMacro();

                SPEventReceiverDefinition doDefinition = SPListHelper.GetListItemEvent(
                    addlistitemeventreceiver.TestWeb,
                    addlistitemeventreceiver.FirstEntity.ListName,
                    SPEventReceiverType.ItemAdded,
                    addlistitemeventreceiver.FirstEntity.AssemblyName,
                    addlistitemeventreceiver.FirstEntity.ClassName);

                Assert.IsNotNull(doDefinition);

                MacroReport unDoReport = addlistitemeventreceiver.UndoMacro();

                SPEventReceiverDefinition undoDefinition = SPListHelper.GetListItemEvent(
                    addlistitemeventreceiver.TestWeb,
                    addlistitemeventreceiver.FirstEntity.ListName,
                    SPEventReceiverType.ItemAdded,
                    addlistitemeventreceiver.FirstEntity.AssemblyName,
                    addlistitemeventreceiver.FirstEntity.ClassName);

                Assert.IsNull(undoDefinition);

            }
        }

    }
}
